var y=0;
var s=0;
function ff(ysf){
    if(ysf%2==0){
        for(var i=2;i<=ysf;i+=2)
        {
            s+=(1/i);
        }
    return s;
}else{
    for(var i=1;i<=ysf;i+=2){
        e+=(1/i)
    }
           return e;
}
}
    console.log(ff(3));